<template>
  <div>
    <el-row>
      <el-col :span="24">
        <!-- 放搜索条件 
          :inline="ture"让表单元素占一行,一行不够会换行-->
        <el-form :inline="true">
          <el-form-item label="登录账号">
            <el-input
              v-model="pdParam.account"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <el-form-item label="操作时间">
            <el-date-picker   v-model="pdParam.startTime" type="date" placeholder="选择日期"
            value-format="yyyy-MM-dd">
            </el-date-picker>
          </el-form-item>

          <el-form-item>
            <el-button type="primary" @click="clear">重置</el-button>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="queryEmployee">查询</el-button>
          </el-form-item>
        </el-form>
      </el-col>

      <el-col :span="24">
        <!-- 放表格数据 -->

        <el-table :data="tableData" style="width: 100%">
          <el-table-column prop="id" label="序号"></el-table-column>
          <el-table-column prop="account" label="登录账号"></el-table-column>
          <el-table-column prop="startTime" label="登录时间"></el-table-column>
          <el-table-column prop="className" label="执行类"></el-table-column>
          <el-table-column prop="methodName" label="执行方法"></el-table-column>
         
        </el-table>
      </el-col>
      <el-col :span="12">
        <!-- 放分页部分 -->
        <el-pagination
          background
          :page-sizes="[3, 5, 10, 20]"
          :page-size="pageSize"
          :current-page="pageNum"
          layout="total, sizes, prev, pager, next"
          @next-click="nextPage"
          @prev-click="prevPage"
          @size-change="sizeChange"
          @current-change="currentPage"
          :total="total"
        ></el-pagination>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      pageNum: 1,
      pageSize: 10,
      total: 0,

      pdParam: {
        account: "",
        startTime: ""
      },
      tableData: [],
    };
  },
  methods: {
    clear() {
      this.pdParam = {};
    },
    prevPage(val) {
      //点击上一页触发
      this.pageNum = val;
      this.queryEmployee();
    },
    nextPage(val) {
      //点击下一页触发
      this.pageNum = val;
      this.queryEmployee();
    },
    sizeChange(val) {
      //val每一页条数
      this.pageNum = 1;
      this.pageSize = val;
      this.queryEmployee();
    },
    currentPage(val) {
      this.pageNum = val;
      this.queryEmployee();
    },
    queryCondition() {
      thispageNum = 1;
      this.queryEmployee();
    },
    queryEmployee() {
      //带分页参数pageNum,pageSize
      let pageParam = {};
      pageParam.pageNum = this.pageNum;
      pageParam.pageSize = this.pageSize;
      pageParam.param = this.pdParam;
      this.$axios.post("api/log/queryLogList", pageParam).then((res) => {
        if (res.data.code == 200) {
          let pageData = res.data.data;
          this.tableData = pageData.list;
          //给分页参数赋值
          this.total = pageData.total;
          this.pageNum = pageData.pageNum;
          this.pageSize = pageData.pageSize;
        } else {
          this.$router.push({ path: "/login" });
        }
      });
    },
  
  },
  created() {
    this.queryEmployee()
  },
};
</script>

<style scoped></style>